/*
 * PlaylistPopupMenu.java
 *
 * Created on April 8, 2006, 2:04 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package com.bff.mpd.musicjukebox.ui.components;

import com.bff.mpd.musicjukebox.lib.actions.DisplaySongInfoAction;
import com.bff.mpd.musicjukebox.lib.actions.PlaySongAction;
import com.bff.mpd.musicjukebox.lib.actions.PlaylistRemoveAction;
import javax.swing.JFrame;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
import org.bff.javampd.MPDPlayer;
import org.bff.javampd.MPDPlaylist;
import org.bff.javampd.objects.MPDSong;

/**
 *
 * @author Bill
 */
public class PlaylistPopupMenu extends JPopupMenu {
    private MPDPlaylist playlist;
    private MPDPlayer player;

    private JMenuItem playSongMenuItem;
    private JMenuItem removePlaylistMenuItem;
    private JMenuItem displaySongInfoMenuItem;
    
    private MPDSong song;
    private JFrame parent;
    /** Creates a new instance of PlaylistPopupMenu */
    public PlaylistPopupMenu(JFrame parent, 
            MPDPlaylist playlist,
            MPDPlayer player,
            MPDSong song) {
        this.playlist = playlist;
        this.song = song;
        this.parent = parent;
        this.player = player;
        createMenuItems();       
    }

    private void createMenuItems() {
        //current playlist
        playSongMenuItem = new JMenuItem(new PlaySongAction(player, song));
        add(playSongMenuItem);
        
        //remove from playlist
        removePlaylistMenuItem = new JMenuItem(new PlaylistRemoveAction(playlist, song));
        add(removePlaylistMenuItem);
        
        //song info
        displaySongInfoMenuItem = new JMenuItem(new DisplaySongInfoAction(parent, song));       
        add(displaySongInfoMenuItem);
    }  
}
